﻿@{
    var checkin="";
    string checkInStyle = string.Empty;
    string checkOutStyle = string.Empty;
    List<EvincePayroll.Data.PageTemplateData> list = Session["Templates"] as List<EvincePayroll.Data.PageTemplateData>;
    if (Session["CheckIn"] != null)
    {
        checkin = Session["CheckIn"].ToString();
    }
    <script type="text/javascript">
        $(document).ready(function () {
            $('#checkin').live('click', function () {
                $.ajax({
                    type: "POST",
                    url: "/Attendance/CheckIn",
                    
                    success: function () {
                        alert("You are logedin system.");
                        $('#checkin').hide();
                        $('#checkout').css({
                            display: 'block'
                        });
                    }
                });
            });
            $('#SubmitCheckout').live('click', function () {
                var otherReason = $('#otherReason').val();
                var checkoutReason = $('#checkoutReason').val();
                var reason;
                if (checkoutReason == '') {
                    reason = otherReason;
                }
                else {
                    reason = checkoutReason;
                }
                if (reason == '') {
                    $('#otherReason').css({
                        border: '1px solid red'
                    });
                }
                else {
                    $.ajax({
                        type: "POST",
                        url: "/Attendance/CheckOut?reason=" + reason,
                        success: function () {
                            $('#checkout').hide();
                            $('#checkin').css({
                                display: 'block'
                            });
                            $('#dialog').dialog("close");
                            
                        }
                    });
                }
            });
        });
        function checkLunchRadio() {
            $('#otherReason').hide();
            $('#otherReason').css({
                border: '1px solid black'
            });
            $('#checkoutReason').val('Lunch');
            $('#otherReason').val('');
        }
        function checkDepartureRadio() {
            $('#otherReason').hide();
            $('#otherReason').css({
                border: '1px solid black'
            });
            $('#checkoutReason').val('Departure');
            $('#otherReason').val('');
        }
        function checkOtherRadio() {
            $('#checkoutReason').val('');
            var value = $('#otherRadio').val();
            if (value == 'on') {
                $('#otherReason').show();
            }
        }
    </script>
    
<div class="grid_12">
<input type="hidden" id="checkoutReason" />
            <ul class="nav main">
                <li class="ic-dashboard"><a href="../Home/DashBoard"><span>Dashboard</span></a> </li>
                
                @if(checkin=="0")
                {
                    checkInStyle = "style=display:block;float:right;";
                    checkOutStyle = "style=display:none;float:right;";
                     
                }
                else if (checkin == "1")
                {
                    checkInStyle = "style=display:none;float:right;";
                    checkOutStyle = "style=display:block;float:right;";
                }
                <li class="ic-form-style"><a href="javascript:"><span>Profile</span></a>
                    <ul>
                        <li><a href="../Account/GetUserProfile">View Your Profile</a> </li>
                        <li><a href="../Account/GetUpdatedUserProfile">Update Your Profile</a> </li>
                        <li><a href="../Account/ChangePassword">Change Your Password</a> </li>
                        
                    </ul>
                </li>
                <li class="ic-grid-tables"><a href="../LeaveRequests/EmployeeLeaveRequestAndStatus"><span>Employee Leave Request</span></a></li>
                <li class="ic-form-style"><a href="../NewsAndEvent/NewsAndEvent">Events</a></li>
                <li class="ic-grid-tables"><a href="../Home/Gallery">Gallaries</a></li>
                 @if (list != null)
                 {
                     foreach (var value in list)
                     {
                <li class="ic-grid-tables"><a href="../PageTemplate/Template?pageId=@value.PageId"><span>@value.DisplayTitle</span></a></li>
                     }
                 }
                 <li class="ic-form-style"><a href="../Home/Skils">Skills</a></li>
                 <li id="checkin" class="ic-grid-tables" @checkInStyle><a  href="#">Check In</a></li>
                 <li id="checkout" class="ic-grid-tables" @checkOutStyle><a  href="#">Check Out</a></li>
                @*<li class="ic-gallery dd"><a href="#"><span>Image Galleries</span></a>
               		 <ul>
                        <li><a href="#">Pretty Photo</a> </li>
                        <li><a href="#">Gallery with Filter</a> </li>
                    </ul>
                </li>
                <li class="ic-notifications"><a href="#"><span>Notifications</span></a></li>*@

            </ul>
        </div>
    }